iOS copy/paste routines
Some basic iOS copy/paste sample code:
1 2 3 4 5 6 7 8 9 10 11 12 13 | #import "UIPasteboard.h" void iphone_copy( char *text) { UIPasteboard *pb = [UIPasteboard generalPasteboard]; NSString *nstext = [NSString stringWithCString:text encoding:NSUTF8StringEncoding]; [pb setValue:nstext forPasteboardType:@ "public.plain-text" ]; } const char *iphone_paste() { UIPasteboard *pb = [UIPasteboard generalPasteboard]; NSString *nstext = [pb valueForPasteboardType:@ "public.utf8-plain-text" ]; return [nstext cStringUsingEncoding:NSUTF8StringEncoding]; } |